package org.rency.ues.engine.converter;

import org.rency.ues.dal.entity.DataHashDO;
import org.rency.ues.domain.model.DataHashDomain;

/**
 * ${todo}
 *
 * @author: Created by user_rcy@163.com on 2016/8/3.
 * @version: V1.0.0
 * @since JDK 1.8
 */
public class DataHashConverter {

    public static DataHashDomain build(String ticket, String hash){
        DataHashDomain domain = new DataHashDomain();
        domain.setTicket(ticket);
        domain.setHash(hash);
        return domain;
    }

    public static DataHashDO convert(DataHashDomain domain){
        if(domain == null){
            return null;
        }
        DataHashDO entity = new DataHashDO();
        entity.setId(domain.getId());
        entity.setTicket(domain.getTicket());
        entity.setHash(domain.getHash());
        return entity;
    }

    public static DataHashDomain convert(DataHashDO entity){
        if(entity == null){
            return null;
        }
        DataHashDomain domain = new DataHashDomain();
        domain.setId(entity.getId());
        domain.setTicket(entity.getTicket());
        domain.setHash(entity.getHash());
        return domain;
    }
}
